<template>
   <div>
     <header class="fir">
      <image :src="src1" class="fir1" resize="cover" @click="back()"></image>
      <div class="fir_title">
         <text class="fir_title_text" @click="shop()">商品</text>
         <text class="fir_title_text" @click="particulars()">详情</text>
         <text class="fir_title_text" @click="other()">其他</text>
      </div>
     </header>
     <div class="line">
       <div class="line1" v-if="line1"></div>
       <div class="line2" v-if="line2"></div>
       <div class="line3" v-if="line3"></div>
     </div>
     <router-view></router-view>
   </div>
</template>
<style scoped>
   .fir{
      width: 100%;
      height: 48px;
      padding-top: 12px;
      box-sizing: border-box;
      justify-content: center;
      align-items: center;
   }
   .fir1{
      width: 15px;
      height: 20px;
      position: absolute;
      left: 12px; 
   }
   .fir_title{
      width: 185px;
      height: 15px;
      /*background-color: silver;*/
      justify-content: space-between;
      flex-direction: row;
   }
   .fir_title_text{
      height: 15px;
      line-height: 15px;
      font-size: 15px;
   }
   .line{
      width: 210px;
      height: 4px;
      margin-left: auto;
      margin-right: auto;
      /*background-color: #33c179;*/
      justify-content: space-between;
      flex-direction: row;
      position: relative;
   }
   .line1,.line2,.line3{
      width: 60px;
      height: 4px;
      background-color: #33c179;
      border-radius: 25px;
      position: absolute;
   }
   .line2{
      left: 75px;
   }
   .line3{
      right: 0;
   }
</style>
<script>
export default {
    data () {
        return {
           src1: 'http://192.168.2.123:8080/img/index_back.png',
           line1: true,
           line2: false,
           line3: false,
        }
    },
    methods: {
      // 点击商品
      shop(){
        this.$router.push('/shop_commodity_particulars'); //显示商品组件
        this.line2 = false; //详情下面的线隐藏
        this.line3 = false; //其他下面的线隐藏
        this.line1 = true;
      },
      // 点击详情
      particulars(){
        this.$router.push('/shop_commodity_child');
        this.line2 = true;
        this.line3 = false;
        this.line1 = false;

      },
      other(){
        this.$router.push('/shop_other');
        this.line3 = true;
        this.line1 = false;
        this.line2 = false;
      },
      // 点击返回
      back(){
        this.$router.back(-1);
      }
    }
}
</script>
